package com.wbp.cms.core.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.wbp.cms.client.common.domain.OrganizationDO;
import com.wbp.cms.client.common.query.OrganizationQuery;


/**
 * @Description:
 * @Department:
 * @author andy.lhc
 * @date 2016年3月9日 下午4:41:52
 */
@Repository("organizationDAO")
public class OrganizationDAO extends BaseDao {

  public Long insert(OrganizationDO organizationDO) {
    super.insert("OrganizationMapper.insert", organizationDO);
    return organizationDO.getId();
  }

  public int update(OrganizationDO organizationDO) {
    return super.update("OrganizationMapper.update", organizationDO);
  }

  public OrganizationDO load(Long organizationId) {
    Object obj = super.selectOneObject("OrganizationMapper.load", organizationId);
    return obj == null ? null : (OrganizationDO) obj;
  }

  public List<OrganizationDO> query(OrganizationQuery organizationQuery) {
    return super.selectList("OrganizationMapper.query", organizationQuery);
  }

  public Integer queryCount(OrganizationQuery organizationQuery) {
    Object obj = super.selectOneObject("OrganizationMapper.queryCount", organizationQuery);
    return obj == null ? 0 : (Integer) obj;
  }

  public List<OrganizationDO> queryChildOrganization(Long organizationId) {
    return super.selectList("OrganizationMapper.queryChildOrganization", organizationId);
  }


}
